#include<linux/fs.h>
#include<linux/module.h>


unsigned int major;

static int hello_open(struct inode *inode, struct file *filp)
{
   printk("%s %s %d\n", __FILE__,__FUNCTION__, __LINE__);
   return 0;
}

static ssize_t hello_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{
	printk("%s %s %d\n", __FILE__,__FUNCTION__, __LINE__);
	return count;
}

static ssize_t hello_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
	printk("%s %s %d\n", __FILE__,__FUNCTION__, __LINE__);
	return count;
}
static int hello_release (struct inode *inode, struct file *filp)
{
	printk("%s %s %d\n", __FILE__,__FUNCTION__, __LINE__);
	return 0;
}

static const struct file_operations hello_drv = {
    .owner      = THIS_MODULE,
	.read		= hello_read,
	.write		= hello_write,
	.open		= hello_open,
	.release    = hello_release,
};

static int hello_drv_init(void)
{
   major = register_chrdev(0, "hello_drv", &hello_drv);
   return 0;
}

static void hello_drv_exit(void)
{
   unregister_chrdev(major, "hello_drv");
}

module_init(hello_drv_init);
module_exit(hello_drv_exit);
MODULE_LICENSE("GPL");